/*
Generate all the possible substrings using the characters of a given string. Write code. (The order of chars do not matter, i.e., ac <=> ca)
i/p: abc
o/p: { a,b,c,ab,ac,bc,abc}

<Modified the language of the question, to avoid any confusions>
*/

#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <fstream>
#include <set>

using namespace std;

vector<string> getPermutation(string &str)
{
    vector<string> ans;
    for (int i = 0; i < (1 << str.size()); i++) {
        string s;
        for (int j = 0; j < str.size(); j++) {
            if (i & (1 << j)) s += str[j];
         }
         ans.push_back(s);
    }
    return ans;
}

int main(int argc, char **argv)
{
    string str("abc");
    vector<string> ans = getPermutation(str);
    for (int i = 0; i < ans.size(); i++)
        cout << ans[i] << endl;
}
